<template>
	<view>
		<view class="p-20">
			<view class="p-b-20">
				<text class="cred  f30">程序里都是演示图标请自行更换;</text>
				<text class="m-l-10 cred">https://www.iconfont.cn/</text>
				<text class="m-l-10 cred">图标库;尊重原创版权可以付款购买图标哦(一般2元一个)</text>
			</view>
			<view class="banmi_flex j-c" style="width: 400px;position: fixed;bottom: 50px;z-index: 88;">
				<view class=" banmi_flex a-c j-c  b_y cff" @click="on_users_cx()" type="primary"
					style="width: 400px;height: 50px;background-color: #007AFF;" size="mini">保存</view>
			</view>
			<view class="banmi_flex   ">
				<view class="p-20" style="width: 400px;background-color: #FaFaFa;">
					<view class="  a-c  p-b-20" v-for="(vo,index) in my_list1">
						<view class="" style="width: 400px;">
							<view>
								<uni-easyinput v-model="vo.name" placeholder="" :clearable="false">
								</uni-easyinput>
							</view>
							<view class="p-t-20">
								<uni-easyinput v-model="vo.url" placeholder="路径" :clearable="false">
								</uni-easyinput>
							</view>
						</view>

						<view class="banmi_flex p-t-20">
							<view class="ml2 ">
								<image style="width: 50px;height: 50px;" :src="vo.img"></image>
							</view>
							<view class="m-l-10 p-t-20">
								<button @click="on_img(1,index)" type="primary" size="mini">更换图标</button>
							</view>
						</view>

					</view>
					<view class="  a-c  p-b-20" v-for="(vo,index) in my_list2">
						<view class="" style="width: 400px;">
							<view>
								<uni-easyinput v-model="vo.name" placeholder="" :clearable="false">
								</uni-easyinput>
							</view>
							<view class="p-t-20">
								<uni-easyinput v-model="vo.url" placeholder="路径" :clearable="false">
								</uni-easyinput>
							</view>
						</view>

						<view class="banmi_flex p-t-20">
							<view class="ml2 ">
								<image style="width: 50px;height: 50px;" :src="vo.img"></image>
							</view>
							<view class="m-l-10 p-t-20">
								<button @click="on_img(2,index)" type="primary" size="mini">更换图标</button>
							</view>
						</view>
					</view>
				</view>

				<view class="ml2" style="width: 400px;background-color: #FaFaFa;">
					<view class="p-b-20" style="height: 250rpx;">
						<view class="banmi_flex j-f p-t-20" style="padding-right: 60rpx;">

						</view>
						<view class=" banmi_flex a-c"
							style="padding-top: 10rpx;padding-right: 60rpx;padding-left: 60rpx;">
							<view class="">

								<image class="q-y" src="../../static/app.png"
									style="width: 130rpx;height: 130rpx;border:3px solid #fff;">
								</image>
							</view>
							<view class="ml20" style="margin-top: -10rpx;">
								<text class="w800" style="font-size: 40rpx;color: #333;">请登陆！</text>
								<view class=" pt1">
									<text>Uid:000000</text>
								</view>
							</view>
						</view>

					</view>

					<view class="p-10" style="padding-right: 30rpx;padding-left: 30rpx;">
						<view class="p-10 b_y" style="margin-top: -20rpx;background-color: #fff;">
							<view class="p-b-20 banmi_flex j-b">
								<view class="f-16">
									我的订单
								</view>
								<view class="c-7  ">
									<text class="f-14">全部订单</text>
								</view>
							</view>
							<view class="banmi_flex j-b a-c">
								<view class="t_c p-10" v-for="(vo,index) in my_list1" :key="index"
									tyle="position: relative;">
									<view class="" style="position: relative;">
										<view class="t_c">
											<image style="width: 80rpx;height: 80rpx;" :src="vo.img"></image>
											<view class="c_z f28 f800 pt1">{{vo.name}}</view>
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>

					<view class="p-10" style="padding-right: 30rpx;padding-left: 30rpx;">
						<view class="p-10 b_y" style="margin-top: -20rpx;background-color: #fff;">
							<view v-for="(vo,index) in my_list2" :key="index" class="p-10"
								style="padding-top: 40rpx;padding-bottom: 40rpx;">
								<view class="banmi_flex j-b a-c">
									<view class="banmi_flex a-c" style="position: relative;">

										<image style="width: 70rpx;height: 70rpx;" :src="vo.img">
										</image>
										<text class="m-l-10">{{vo.name}}</text>
									</view>
									<view class="banmi_flex a-c">
										<icon-right size="40" color="#333"></icon-right>
									</view>
								</view>
							</view>



						</view>
					</view>

				</view>
			</view>
		</view>
		<view class="" style="height: 200rpx;">

		</view>

		<uni-popup ref="alertDialog_image" type="dialog">
			<uni-popup-image :imgList="imgList.length" :count="1" t_type="images" t_name="图片" @confirm="confirm_img">
			</uni-popup-image>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				my_list1: [],
				my_list2: [],
				token: '',
				imgList: []
			}
		},
		onLoad() {
			this.init();
		},
		methods: {
			on_img(id, index) {
				this.index = index;
				this.id = id;
				this.$refs.alertDialog_image.open()
			},
			confirm_img(img) {
				if (this.id == 1) {
					this.my_list1[this.index]['img'] = uni.getStorageSync('img_url') + img[0]['attachment'];
				} else {
					this.my_list2[this.index]['img'] = uni.getStorageSync('img_url') + img[0]['attachment'];
				}
			},

			init() {
				var that = this;
				let requestParams = {};
				this.Http.post('banmichaoqiangbizhi/admin/Settings/index', requestParams).then(ret => {
					this.img_url = ret.data.url;
					var my_list1 = ret.data.set_find.my_list1;
					var my_list2 = ret.data.set_find.my_list2;
					this.my_list1 = my_list1;
					this.my_list2 = my_list2;


				})
			},
			on_users_cx() {
				var that = this;

		 

				let requestParams = {
					my_list1: JSON.stringify(this.my_list1),
					my_list2: JSON.stringify(this.my_list2) 
				};
				this.Http.post('banmichaoqiangbizhi/admin/Settings/save_my_list', requestParams).then(ret => {
					uni.showToast({
						title: ret.msg,
						icon: 'none'
					})
				})
			},
		}
	}
</script>

<style>
	page {
		background-color: #fff;
	}
</style>